package lapsnake.model.expr;

import java.util.ArrayList;

import lapsnake.model.*;
import lapsnake.model.data.*;
import lapsnake.model.data.SingleChild;
import lapsnake.py.ast.ASTHelperFactory; import java.beans.PropertyVetoException;
import org.python.antlr.ast.*;

/**Wrapper class with helper functions for Compare nodes
 * 
 * This node has a list of enums which must match a list of comparator expressions.
 * Thus the interface might be a bit strange?*/
public class LapCompare extends LapExpression {
	SingleChild<LapExpression> left = new SingleChild<>(this, LapExpression.class);
	private final ArrayList<cmpopType> cmpOps = new ArrayList<>();
	private final ChildList<LapExpression> comparators = new ChildList<>(this, LapExpression.class, false); //TODO find out if optional
	
	public LapCompare(PyAST pyAST, ChildField<? super LapCompare> parent, Compare node) throws PropertyVetoException {
		super(pyAST, parent, node);
		
		ASTHelperFactory.makeHelper(pyAST, left, node.getInternalLeft());
		ASTHelperFactory.makeHelpers(pyAST, comparators, node.getInternalComparators());
		cmpOps.addAll(node.getInternalOps());
		
		buildTextNodes(node);
	}
}
